<?php
namespace cosocket\system\database\wrappers;

use cosocket\system\database\pools\RedisPool;

class RedisWrapper
{
    private $rediscli = null;
    private $name = null;

    public function __construct($name,$rediscli)
    {
        $this->name = $name;
        $this->rediscli = $rediscli;
    }

    public  function  __destruct()
    {
        if($this->rediscli){
            RedisPool::put($this->name,$this->rediscli);
        }
    }

    public function __call($fname, $arguments)
    {
        return $this->rediscli->$fname(...$arguments);
    }
}